home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 5 / BBS in a Box -Volume V (BBS in a Box) (April 1992).iso / Files / Prog / T / ThinkC5.0.2 Update.cpt / About THINK C 5.0.2 next >
Encoding:
Text File  |  1992-01-09  |  25.7 KB  |  676 lines  |  [TEXT/ttxt]

  1. ABOUT THINK C 5.0.2
  2. ===================
  3. Copyright © 1992 Symantec Corporation. All rights reserved.
  4. January 9, 1992
  5. Font: Geneva 12
  6.  
  7. INTRODUCTION
  8. =============
  9. THINK C 5.0.2 corrects some problems with debugging programs on a 
  10. Macintosh Quadra and corrects some other problems in THINK C 5.0.  
  11.  
  12. This document has five sections:
  13.  
  14.     •  UPDATING THINK C tells you how to run “THINK C -> 5.0.2” to 
  15.         update your copy of THINK C.
  16.  
  17.     •  WHAT THIS UPDATE FIXES lists the most important bugs that 
  18.         this update fixes.
  19.  
  20.     •  LAST MINUTE CHANGES lists some last minute changes and 
  21.         corrections to the THINK C User Manual and Standard Libraries
  22.         Reference. This section contains much of the information in the 
  23.         READ ME file on your THINK C 5.0 disk, in addition to some more  
  24.         recent information. 
  25.  
  26.     •  TECH TIPS answers some common questions that people ask  
  27.         our Technical Support staff. When you have a problem with 
  28.         THINK C, use this section along with Appendix B, 
  29.         “Troubleshooting,” to try to find a solution. And when you 
  30.         port a program from THINK C 4.0 to THINK C 5.0, use this 
  31.         section along with Appendix A, “What’s New,” for some helpful 
  32.         hints.   
  33.  
  34.     •••••••••
  35.     IMPORTANT
  36.     •••••••••
  37.         Some copies of the Object-Oriented Programming Manual have 
  38.         a misprint: page 313 is a duplicate of page 321. To get a copy of
  39.         the correct 313, you need to use the THINK Class Library 1.1.1 
  40.         update.
  41.  
  42. UPDATING THINK C
  43. =================
  44. This update transforms your existing THINK C 5.0 application to THINK C 
  45. 5.0.2. You will run the patch program “THINK C -> 5.0.2” and then replace
  46. your debugger.
  47.  
  48.     •••••••••
  49.     IMPORTANT
  50.     •••••••••
  51.         The partition size for THINK C -> 5.0.2 is set to 1 Mb (megabyte). 
  52.         If you have only 1 Mb of RAM, you’ll need to set the partition size 
  53.         to 650K. In the Finder, select the THINK C -> 5.0.2 application, 
  54.         choose Get Info…, and edit the Current Size field in the Get 
  55.         Info… dialog. If you set the partition below 650K, the application
  56.         may quit with error ID = -108.  Your THINK C application isn’t
  57.         damaged, and you can run the update program again with a
  58.         larger partition.
  59.  
  60.     1. Make sure that you have your original THINK C application.
  61.         You won't need it for this update, but you should make
  62.         sure that you have a backup in case the update fails. Do not
  63.         patch your original master disk.
  64.  
  65.     2. Double-click on the patch program "THINK C -> 5.0.2" to
  66.         launch it. Click on the Update THINK C button to continue.
  67.  
  68.     3. Find your existing copy of THINK C in your THINK C Folder.
  69.         Select it and click on the Patch button.
  70.  
  71.     4. If the patch was successful, you'll get a confirmation.
  72.     
  73.     5. Replace your THINK C Debugger 5.0 with the THINK C 5.0
  74.         Debugger included with the upgrade.
  75.     
  76.     6. Recompile all the files in your projects to make sure they
  77.         take advantage of the changes. To recompile a project, open 
  78.         it in THINK C, choose Remove Objects from the Project menu, 
  79.         and choose Bring Up To Date from the Project menu.
  80.  
  81. WHAT THIS UPDATE FIXES
  82. =======================
  83. THINK C 5.0.2 corrects some problems with debugging programs on a 
  84. Macintosh Quadra and corrects some other problems in THINK C 5.0. 
  85. This section describes the most significant bugs that THINK C 5.0.2 fixes. 
  86. It contains these parts:
  87.  
  88. •  “The Environment” describes what’s fixed in the THINK C 
  89.     environment.
  90. •  “The Debugger” describes what’s fixed in the THINK C Debugger.
  91. •  “Optimizations” describes what’s fixed in THINK C’s global optimizer and
  92.      other optimizations.
  93. •  “Object-Oriented Programming Extensions” describes what’s fixed in 
  94.     THINK C’s object-oriented programming extensions.
  95. •  “Compiler and Linker” describes what else is fixed in THINK C‘s compiler 
  96.     and linker.
  97.  
  98. The Environment
  99. ---------------
  100. •  When you’re running System 7.0 in 32-bit addressing mode, these features
  101.     now work correctly:
  102.         √ The “Grep” option in the Find… dialog.
  103.         √ Using the Browser to look up a method or class definition.    
  104.         
  105. •  Some utilities that add features to the THINK C 5.0 editor will not 
  106.     work with THINK C 5.0.2. Contact the author of the utility for a new 
  107.     version.
  108.  
  109. •  The Get Info… dialog doesn’t truncate the last character of the JUMP table
  110.     size.
  111.  
  112. •  In the Options… dialog, the Copy button now works correctly.
  113.  
  114. •  In the Set Project Type… dialog, five-digit numbers now fit in the 
  115.     Partition field. Also, the dialog will not let you enter values greater
  116.     than 32767 in the Partition field. 
  117.  
  118. •  The Size Flags menu in Set Project Type… dialog  contains a new option: 
  119.     Use TextEdit Services. Set this bit if your application lets the user use 
  120.     inline input to enter text in a script system that uses ideographs.
  121.  
  122. • The Browser does not combine the method lists for classes that have 
  123.    similar names. Also, it no longer places method menus off the screen on 
  124.    some monitors.
  125.  
  126. The Debugger
  127. ------------
  128. •  The debugger works correctly on a Macintosh Quadra.
  129.  
  130. •  In a Data window, you can enter a value greater than 0x7FFFFFFF for a
  131.     integer.
  132.  
  133. •  You will not crash the debugger by selecting Go soon after it’s launched.
  134.  
  135. Optimizations
  136. -------------
  137. •  The “Suppress redundant loads” option is more careful when choosing to
  138.     suppress a load.
  139.  
  140. •  The “CSE elimination” option is more careful when deciding
  141.     whether to eliminate common sub-expressions in switch expressions.
  142.     
  143. •  The “Induction variable elimination” option is more careful when 
  144.     deciding whether an expresion is an induction variable.
  145.     
  146. •  The “CSE elimination” and “Register coloring” options are more careful 
  147.     when optimizing statements with the operators && or ||.
  148.  
  149. •  The nooptimize pragma directive disables more optimizations. In addition 
  150.     to disabling the global optimizer, it also turns off automatic register 
  151.     assignment. For more information on the nooptimize pragma directive, 
  152.     see “The pragma nooptimize directive” on page 195 in THINK C User
  153.     Manual.
  154.  
  155. Object-Oriented Programming Extensions
  156. -------------------------------------
  157. •  THINK C now flags as an error a static member function that references
  158.     a non-static member of a class without an object pointer.
  159.     
  160. •  Calling a virtual static method works correctly.
  161.  
  162. Compiler and Linker
  163. ------------------
  164. •  There is now a limit of 256 segments per project. Previously, there was
  165.     a limit of 128 segments per project.
  166.     
  167. •  You do not get the incorrect error message “internal error: Bad ZREF,” if 
  168.     the linker encounters an error while building your program. 
  169.  
  170. •  Using the Separate STRS option does not crash THINK C.
  171.  
  172. •  In a link map, offsets for all entry points in the main segment are 
  173.     correct.
  174.      
  175. •  If you use typedef to define a type as void and declare something with 
  176.     that type, you do not get the error message “illegal use of void”.
  177.     
  178. •  If there are several #define statements before a precompiled header, 
  179.     THINK C does not generate an internal compiler error. 
  180.     
  181. •  THINK C now generates an error message if you try to precompile a 
  182.     header that #defines something before #include’ing a precompiled
  183.     header.
  184.  
  185. •  THINK C now correctly stores the size of array types declared in
  186.     precompiled headers. 
  187.  
  188. •  If a macro and a type have the same name, and you use the name to 
  189.     declare a variable, THINK C does not give you the incorrect error message 
  190.     “invalid declaration.”     
  191.  
  192. •  A multi-segment code resource, driver, or desk accessory built with 
  193.     THINK C works correctly if it is unlocked and moves in memory.
  194.     
  195. •  When assigning one struct to another, the code THINK C generates now
  196.     works correctly if the source struct is cached in an MC68040 data
  197.     register.
  198.  
  199. •  The FNEG.X instruction generates correct code when you use it with a 
  200.     single floating-point register argument. Previously, for example,   
  201.     “FNEG.X FP0” generated code for “FABS.X FP0”.
  202.  
  203.  
  204. LAST MINUTE CHANGES
  205. ====================
  206. This section lists some last minute changes and corrections to the THINK C 
  207. User Manual and Standard Libraries Reference. It contains much of the 
  208. information in the READ ME file on your THINK C 5.0 disk, in addition to some 
  209. more recent information.
  210.  
  211. Welcome
  212. --------
  213. • If you have only one megabyte of RAM, you cannot compile projects that
  214.    use MacHeaders. Instead, try to create a smaller precompiled header
  215.    that includes only those header files you need. For more information, see
  216.    “Editing the MacHeaders file” on page 165. You can compile projects that 
  217.    use the ANSI library with one megabyte.
  218.          
  219. Installing THINK C 5.0
  220. --------------------
  221. • On page 20, step 4 should refer you to Figure 2-2, not 2-1.
  222.  
  223. • On page 21, the folder is shown in Figure 2-3, not 2-1.
  224.  
  225. Tutorial: Hello World
  226. -------------------
  227. •  On page 34, the error message in Figure 3-7 is incorrect and should
  228.     be “can’t open file ‘stdio.h’.” And in the first complete sentence on page 
  229.     35, the folder THINK C can’t find is the C Libraries folder.
  230.  
  231. Tutorial: MiniEdit
  232. ----------------
  233. •  The first paragraph on page 49 tells you to click the wrong button. You
  234.     should click on the Done button, not the Cancel button.
  235.  
  236. •  On pages 55 and 56, the Set Project Type… dialog in Figures 4-14 and 
  237.     4-15 probably doesn’t match yours. The default value for the SIZE Flags
  238.     field is 0000, and not 0800. The project works correctly with either 
  239.     value.
  240.     
  241. •  On page 57,  the first sentence of the section “Using a Resource File” is
  242.     incorrect. You didn’t copy the MiniEdit Folder from disk THINK C 4. 
  243.     Instead you installed it with the self-extracting archive “THINK C 5.0 
  244.     Demos.sea,” according to the instructions in Chapter 2, “Installing 
  245.     THINK C 5.0.”
  246.     
  247. Tutorial: Bullseye
  248. -----------------
  249. •  On page 68, Figure 5-11 shows a hollow arrow pointing at BeginUpdate().
  250.     If you follow the instructions up to here, you’ll actually see a solid
  251.     arrow pointing at EndUpdate().
  252.  
  253. The Project
  254. -----------
  255. •  In THINK C 5.0.2, the Size Flags menu in Set Project Type… dialog  
  256.     contains a new option: Use TextEdit Services. Set this bit if your 
  257.     application lets the user use inline input to enter text in a script 
  258.     system that uses ideographs.
  259.     
  260. Files & Folder
  261. -------------
  262. •  There are some restrictions on once-only headers (#pragma once). 
  263.     √  #Pragma once case sensitive. For example, if you include a file once 
  264.         with the statement “#include <stdio.h>” and later with the statment
  265.         “#include <StdIO.h>”, THINK C will include it twice.
  266.     √  #Pragma once doesn’t distinguish between files included with <...> 
  267.          and "...". For example, say you have two header files named xyz.h, one 
  268.          in the THINK C tree and one in the project tree. If you include one with 
  269.          “#include <xyz.h>” and another with “#include "xyz.h"”, THINK C will
  270.          not include the second file.
  271.     
  272. The Compiler
  273. -------------
  274. •  The THINK C compiler and optimizer use MultiFinder memory. If you get an
  275.     “Out of Memory” error, quit your other running applications to increase 
  276.     the amount of MultiFinder memory available.
  277.  
  278. •  The optimizer can take a long time to optimize extremely large and 
  279.     complex functions (typically, more than 10 pages of dense code).
  280.  
  281.  •  In THINK C 5.0.2, the nooptimize pragma directive does more. In addition 
  282.      to disabling the global optimizer, it also turns off automatic register 
  283.      assignment and honors register declarations. For more information on 
  284.      the nooptimize pragma directive, see “The pragma nooptimize directive” 
  285.      on page 195.
  286.      
  287. •  In THINK C 5.0.2, there are two new options for the options pragma
  288.     directive. You cannot change these options within a function. For more 
  289.     information on the options pragma directive, see page “Accessing Option 
  290.     Settings in You Code” on page 195.
  291.  
  292.     √ class_names: If this option is off, THINK C does not generate class 
  293.         names in the runtime data structures for classes and you cannot use 
  294.         the new_by_name() or class_name() functions. Turning this option 
  295.         off can significantly reduce the size of your global data if you 
  296.         use very long class names.
  297.     
  298.     √ align_arrays: You can use this to defeat the alignment of even-length 
  299.         char arrays within structs. For example,
  300.     
  301.             struct S {
  302.                 char f1;
  303.                 char f2[7];
  304.                 char f3;
  305.                 char f4[8];
  306.                 char f5;
  307.             };
  308.     
  309.         Normally, THINK C allocates the member f4 on an even boundary and 
  310.         inserts a pad byte between f3 and f4. The entire struct occupies
  311.         20 bytes. If the align_arrays option is off, THINK C allocates f4 on an
  312.         odd boundary and doesn’t insert a pad character. The struct occupies
  313.         only 18 bytes.
  314.  
  315. The Assembler
  316. --------------
  317. •  The note on page 270 needs some explanation. When you write a 
  318.     function with in-line assembly and you declare that function pascal,  you 
  319.     need to return the function’s value in a return statement outside the 
  320.     assembly block. Don’t put the return value into D0 yourself. For example, 
  321.     use this:
  322.     
  323.             pascal int foo (void)
  324.             {
  325.                 asm {
  326.                     . . .
  327.                 }
  328.                 return 1;
  329.              }
  330.         
  331.     instead of this:
  332.     
  333.             pascal int foo (void)
  334.             {
  335.                 asm {
  336.                     . . .
  337.                     move.w     #1, D0
  338.                 }
  339.              }
  340.  
  341.     Also note that you cannot return a value from an assembly block.
  342.     In an assembly block, you can use a return statement only if it does not 
  343.     return a value. For example, this code fragment causes an error: 
  344.     
  345.             pascal int foo (void)
  346.             {
  347.                 asm {
  348.                     . . .
  349.                     return 1    // NO! Cannot return a value from
  350.                 }                   // within an asm block
  351.              }    
  352.                  
  353. •  In THINK C 5.0, you need to write multi-line assembly language macros
  354.     differently than with earlier versions of THINK C. For example, this
  355.     multi-line macro causes an error in THINK C 5.0:
  356.  
  357.         #define LongMult(r, s1, s2) \
  358.             asm {  \
  359.                 move.w  s1, d0  \
  360.                 muls  s2, d0  \
  361.                 move.l  d0, r \
  362.             }
  363.  
  364.         void foo(void)
  365.         {
  366.             int a, b;
  367.             long d;
  368.  
  369.             LongMult(d, a, b)    // Syntax error
  370.             . . .
  371.         }
  372.  
  373.     Multi-line assembler macros cause errors because the THINK C 5.0
  374.     preprocessor expands the macro as one long line, like this:
  375.  
  376.         asm { move.w s1, d0  muls s2, do  move.l d0,r }
  377.  
  378.     The inline assembler doesn’t recognize the expansion as valid assembly
  379.     language. You can define the macro like this:
  380.  
  381.         #define LongMult(r, s1, s2) \
  382.             asm { move.w  s1, d0 } \
  383.             asm { muls  s2, d0  } \
  384.             asm { move.l  d0, r } 
  385.  
  386.     Or you can define LongMult as just the assembly language statements, 
  387.     without enclosing them in asm { . . . }, like this:
  388.  
  389.         #define LongMult(r, s1, s2) \
  390.             move.w  s1, d0  \
  391.             muls  s2, d0  \
  392.             move.l  d0, r 
  393.  
  394.     And then use the macro like this:
  395.  
  396.         void foo(void)
  397.         {
  398.             int a, b;
  399.             long d;
  400.  
  401.             asm {
  402.                 LongMult(d, a, b) 
  403.             }
  404.         . . .
  405.         }
  406.  
  407. •  On page 267, there’s an error in the section “C function entry.” It 
  408.     incorrectly states how THINK C handles a char-sized argument. The last 
  409.     two paragraphs in that section should read:
  410.     
  411.         All arguments occupy an even number of bytes on the stack.
  412.         If there is no prototype for a char-sized argument, it is placed 
  413.         in the low byte of an int, which may be 2 or 4 bytes, depending
  414.         on your option settings.
  415.         
  416.         If there is a prototype for a char-sized argument, it is placed
  417.         in the high byte of a short.
  418.         
  419. •  On page 270, Figure 13-3 is incorrect. The positions of arg-1 and arg-N
  420.     should be reversed, like this:
  421.  
  422.                -------------------------------
  423.                  Space for return value (if any)
  424.                -------------------------------
  425.                  arg-1
  426.                -------------------------------
  427.                  . . .
  428.                -------------------------------
  429.                  arg-N
  430.                -------------------------------
  431.        SP->   return address
  432.                -------------------------------
  433.                
  434.     The text above Figure 13-3 is correct.
  435.            
  436. The Debugger
  437. ------------
  438. •  To stop the debugger from saving the current session, hold down the 
  439.     Option key as you exit the debugger.
  440.  
  441. •  To make the debugger display the source and data window in their
  442.     default positions, hold down the Shift key as you enter the debugger.
  443.  
  444. •  To stop the debugger from restoring saved breakpoints and data 
  445.     expressions hold down the Option key as you enter the debugger.
  446.     
  447. •  Do not step into Macintosh Toolbox routines OpenPicture(), Open Poly(),
  448.     OpenRgn(). Your machine could crash.
  449.     
  450. The Profiler
  451. -----------
  452. •  The instructions in the last paragraph of  “Changing which timer to use” 
  453.     on page 285 are incorrect. They should read:
  454.  
  455.         To create a profile library that uses the tick counter, follow 
  456.         these steps:
  457.         1.  In the Finder, create a new copy of the profile project and 
  458.              give it a new name, like tick profile.
  459.         2.  Open the new project with THINK C.
  460.         3.  Choose Options… from the Edit menu.
  461.         4.  Select Prefix from the pop-up menu in the Options…  dialog.
  462.         5.  Comment out the line that defines _VIATIMER_. It should 
  463.              look like this: “/*  #define _VIATIMER_  */”.
  464.         6.  Click OK.
  465.         7.  Choose the Compile command to recompile the file.
  466.  
  467. oConv
  468. ------
  469. • oConv can convert most reference records, despite what it says in the
  470.    section “Conversion Limits” on page 294. It can convert most records 
  471.    from high-level languages and many from assembly language. Here are
  472.    some types of references it cannot convert:
  473.    √  32-bit relative references generated by the -m switch in the MPW C 
  474.         compiler
  475.    √  32-bit relative references from assembly language
  476.    √  16-bit data-to-code or data-to-data references in assembly language.
  477.  
  478.    oConv can convert the reference records created by the examples on 
  479.    page 294.
  480.    
  481. •  In the section “Converting Large .o Files,” the dumpobj command line on
  482.     page 292 is incorrect. It should read:
  483.  
  484.         dumpobj OFILE.o -d -h -i -n > OLIST.txt 
  485.     
  486.     And before you execute the replace command, the file OLIST.txt must be
  487.     in an MPW window.
  488.  
  489. Standard Libraries Reference
  490. --------------------------
  491. •  On pages 208 and 209, the return value for the “isxxxx” family of 
  492.     functions (isalnum(), isalpha(), etc.) is wrong.  The second sentence in
  493.     the second paragraph should read:
  494.  
  495.         It returns non-zero if c is a member of the category,  and 
  496.         0 (zero) value if c isn’t.
  497.         
  498.     And the table in the section “Returns” should read:
  499.     
  500.         If c is…                           The function returns…
  501.         in the category               non-zero
  502.         not in the category         0 (zero)
  503.         
  504. •  The example for printf() on page 238 should be
  505.  
  506.         #include <stdio.h>
  507.         
  508.         main()
  509.         {
  510.             printf ( "pi = %7.5f", 3.141593 );
  511.         }
  512.  
  513. •  In the example for free() on page 181, the typedef should be
  514.  
  515.         typedef struct {
  516.             int a, b;
  517.         } Foo, *FooPtr;
  518.  
  519.  
  520. TECH TIPS
  521. =========
  522. THINK C has many new features and enhancements that help you improve
  523. your code.  Two changes in  THINK C 5.0 affect existing programs and 
  524. programs that you write in the future. The first change is that THINK C 5.0 
  525. conforms the ANSI standard. The second change is that THINK C now uses 
  526. the same Macintosh Toolbox interface files that Apple provides, and these 
  527. files contain more type-checking information than the built-in interfaces 
  528. in earlier versions of THINK C.
  529.  
  530. Though these changes in the THINK C development environment may mean 
  531. some changes to your existing programs, these programs will be easier to 
  532. maintain and more bug-free.
  533.  
  534. MacHeaders uses Apple’s interfaces
  535. --------------------------------
  536. The MacHeaders file that comes with THINK C 5.0 contains the interfaces for 
  537. the most common Macintosh Toolbox routines. This MacHeaders file is 
  538. precompiled with the "Check pointer types" option off, so all pointer types 
  539. in function prototypes are treated as generic pointers of type void *. If you 
  540. want stricter type checking for Macintosh Toolbox routines, follow the 
  541. instructions in Mac #includes.c to turn the stricter checking on.
  542.  
  543. Using stricter type-checking means that you need to cast parameters to 
  544. all Macintosh Toolbox routines, even the common ones like HLock() and 
  545. HUnlock(). The additional work pays off when THINK C catches an attempt to 
  546. pass a variable of the wrong type to a Toolbox routine.
  547.  
  548. Prototype Helper helps convert programs
  549. -------------------------------------
  550. The THINK C 5.0 package includes a tool called Prototype Helper to help you 
  551. convert your programs to the new ANSI standard. Prototype Helper creates 
  552. extra header files that contain the prototypes for all the functions in your 
  553. program files. Prototype Helper also converts old-style function definitions 
  554. to new-style ANSI function definitions. Many programmers report that 
  555. Prototype Helper helped them discover subtle problems that have hidden in 
  556. programs for months.
  557.  
  558. Prototype Helper uses a heuristic to convert your files, and may not always
  559. do what you expect. Since it alters your files in place, be sure to keep a
  560. backup of your files until you’re confident your converted files work 
  561. properly.
  562.  
  563. Function pointer types are more strictly enforced
  564. ---------------------------------------------
  565. THINK C 5.0 is much stricter about function pointer types than earlier 
  566. versions of THINK C.  In older versions, THINK C ignored the parameters to a 
  567. function pointer. For example, THINK C 4.0 treated both of these types 
  568. identically:
  569.  
  570.     typedef int (*SomeProcPtr)();
  571.     typedef int (*OtherProcPtr)(char);
  572.  
  573. THINK C 5.0 treats these two declarations as distinct types. It distinguishes 
  574. function pointer types by parameters as well as return value. THINK C 5.0 
  575. also allows the use of the keyword pascal as part of the function pointer 
  576. type. 
  577.  
  578. This change affects programs that use the type ProcPtr as a generic pointer. 
  579. For example, in THINK C 4.0, you could write this:
  580.  
  581.     ProcPtr fp;
  582.     (*fp)(1, 2L, 3);
  583.  
  584. In THINK C 5.0, this function pointer needs an explicit type. You can cast it 
  585. like this:
  586.  
  587.     ((void (*)(short, long, short)) fp) (1, 2L, 3);
  588.  
  589. Or, even better, you can define a type first:
  590.  
  591.     typedef void (*ShortLongShortFnPtr)(short, long, short);
  592.  
  593.     ShortLongShortFnPtr fp;
  594.  
  595.     fp(1, 2L, 3);
  596.     
  597. Note that the function pointer does not need to be dereferenced to perform 
  598. the call. The compiler does that for you.
  599.  
  600. short * and int * are not the same type
  601. -----------------------------------
  602. By default, the type short and the type int are the same size: 16 bits. 
  603. However, they are not the same type. The difference is particularly apparent 
  604. in functions that take pointers to shorts and pointers to int. For example:
  605.  
  606.     void f(short *p)
  607.     {
  608.        ...
  609.     }
  610.  
  611.     void g(void)
  612.     {
  613.        int j;
  614.  
  615.        f(&j);  // ERROR: types are incompatible
  616.        f((short *)&j);  // OK
  617.      }
  618.  
  619. Note that none of the Macintosh Toolbox routines take ints as parameters. 
  620. They take either shorts or longs.
  621.  
  622. _fp1() and _elems1() are internal SANE routines
  623. -------------------------------------------
  624. If you get an error message about a function called _fp1() or _elems1(), 
  625. don't panic. These are the compiler's name for the SANE routines that 
  626. implement the high-level SANE call on the highlighted line. You may get this 
  627. error if you're using SANE, and if you try and pass a variable of type double 
  628. to a SANE routine that expects an extended. For example, the sqrt() function 
  629. below expects its argument to be of type extended.
  630.  
  631.     #include <SANE.h>
  632.     ...
  633.     extended x;
  634.     x = sqrt((double) 123 / 4);
  635.  
  636. To see exactly how the _fp() function is called, use the Preprocess command 
  637. in the Source menu.
  638.  
  639. Even-sized arrays are now even-word aligned
  640. -----------------------------------------
  641. In some cases, THINK C 5.0 packs binary data differently than earlier 
  642. versions. If you have a structure that describes the format of binary data,  
  643. check whether the fields match up correctly in the new version. THINK C 5.0 
  644. aligns even-length arrays on even word boundaries and introduces a pad byte 
  645. if necessary. For example, in THINK C 4.0 this structure would be 12 bytes 
  646. long:
  647.  
  648.     struct foo {
  649.         char x;
  650.         char y[10];
  651.         char z;
  652.     };
  653.  
  654. The compiler would place the field y immediately after the field x. So y ends 
  655. up on an odd word boundary.
  656.  
  657. In THINK C 5.0, the same structure takes up 14 bytes. In order to align the 
  658. field y, the compiler places a pad byte between x and y. At this point, the 
  659. field z is placed at an odd address, making the structure's length 13 bytes. 
  660. Both THINK C 4.0 and THINK C 5.0 compilers will make sure that a structure 
  661. is an even length, so it is padded out with one more byte at the end.
  662.  
  663. To make sure that the structure is the same size in THINK C 5.0, make the 
  664. array odd-sized, and add the last element of the array as a field just after 
  665. the array. Since THINK C doesn't enforce array bounds checking, you can use 
  666. this declaration the same way as you used the previous one:
  667.  
  668.     struct foo {
  669.         char x;
  670.         char y[9];
  671.         char y10;     // introduce dummy name
  672.         char z;
  673.     };
  674.  
  675. To get the old behavior, turn off the align_arrays pragma directive 
  676. described earlier in this document.